package com.designType.stateType;

public class OrderContext {

    private OrderState currentState;

    public OrderContext() {
        this.currentState = new UnpaidState(); // 初始状态
    }

    public void setState(OrderState state) {
        this.currentState = state;
    }

    // 委托给当前状态对象处理
    public void pay() { currentState.pay(this); }
    public void cancel() { currentState.cancel(this); }
    public void ship() { currentState.ship(this); }
    public void receive() { currentState.receive(this); }
}
